package com.cn.service.impl;

import com.cn.entity.dto.LocationDTO;
import com.cn.service.MapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * 地图接口
 * @date 2021-12-4
 * @author yuhao
 */
@Service
public class MapServiceImpl implements MapService {
    @Autowired
    private RedisTemplate redisTemplate;
    private final static String  REDIS_GRO_KEY = "REDIS_GRO";

    @Override
    public LocationDTO addMapLocation(LocationDTO locationDTO) {
        redisTemplate.opsForGeo().add(REDIS_GRO_KEY,new Point(locationDTO.getLongitude(),locationDTO.getLatitude()),locationDTO.getUserId());
        return locationDTO;
    }

    public static void main(String[] args) {
         String c = "23.0";
        System.out.println(c.split("\\.")[1]);
    }
}
